package com.yonyou.cyxdms.basedata.service.dto;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.yonyou.cyx.framework.bean.dto.base.BaseDTO;
import com.yonyou.cyx.framework.bean.entity.base.BasePO;
import com.yonyou.cyx.function.utils.bean.BeanMapperUtil;
import com.yonyou.cyx.function.utils.jsonserializer.localdatetime.JsonLocalDateTimeDeserializer;
import com.yonyou.cyx.function.utils.jsonserializer.localdatetime.JsonLocalDateTimeSerializer;

import java.io.Serializable;
import java.time.LocalDateTime;


/**
 * <p>
 * 品牌表
 * </p>
 *
 * @author guorp1
 * @since 2018-11-12
 */

public class BrandDTO extends BaseDTO implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 品牌ID
     */
    private Long brandId;
    /**
     * 品牌代码
     */
    private String brandCode;
    /**
     * 品牌名称
     */
    private String brandName;
    /**
     * 是否有效
     */
    private Integer isValid;
    private Long sourceId;
    /**
     * 来源渠道
     */
    private Integer sourceChannel;
    @JsonDeserialize(using = JsonLocalDateTimeDeserializer.class)
    @JsonSerialize(using = JsonLocalDateTimeSerializer.class)
    private LocalDateTime sourceChangedAt;
    /**
     * 是否删除
     */
    private Integer isDeleted;
    /**
     * 是否进口 是：10041001 否：10041002
     */
    private Integer isImport;
    /**
     * TRANS_DTO_TO_PO
     */

    private Integer method;

    //告知下游渠道具体的操作类型,告知下游部用
    private String bizId;
    private String transDtoToPo;

    public BrandDTO() {
        super();
    }


    public Long getBrandId() {
        return brandId;
    }


    public void setBrandId(Long brandId) {
        this.brandId = brandId;
    }


    public String getBrandCode() {
        return brandCode;
    }


    public void setBrandCode(String brandCode) {
        this.brandCode = brandCode;
    }


    public String getBrandName() {
        return brandName;
    }


    public void setBrandName(String brandName) {
        this.brandName = brandName;
    }


    public Integer getIsValid() {
        return isValid;
    }


    public void setIsValid(Integer isValid) {
        this.isValid = isValid;
    }


    public Long getSourceId() {
        return sourceId;
    }


    public void setSourceId(Long sourceId) {
        this.sourceId = sourceId;
    }


    public Integer getSourceChannel() {
        return sourceChannel;
    }


    public void setSourceChannel(Integer sourceChannel) {
        this.sourceChannel = sourceChannel;
    }


    public LocalDateTime getSourceChangedAt() {
        return sourceChangedAt;
    }


    public void setSourceChangedAt(LocalDateTime sourceChangedAt) {
        this.sourceChangedAt = sourceChangedAt;
    }


    public Integer getIsDeleted() {
        return isDeleted;
    }

    public void setIsDeleted(Integer isDeleted) {
        this.isDeleted = isDeleted;
    }

    public Integer getIsImport() {
        return isImport;
    }


    public void setIsImport(Integer isImport) {
        this.isImport = isImport;
    }


    public String getTransDtoToPo() {
        return transDtoToPo;
    }


    public void setTransDtoToPo(String transDtoToPo) {
        this.transDtoToPo = transDtoToPo;
    }


    public Integer getMethod() {
        return method;
    }

    public void setMethod(Integer method) {
        this.method = method;
    }

    public String getBizId() {
        return bizId;
    }

    public void setBizId(String bizId) {
        this.bizId = bizId;
    }

    @Override
    public String toString() {
        return "BrandDTO{" +
                "brandId=" + brandId +
                ", brandCode='" + brandCode + '\'' +
                ", brandName='" + brandName + '\'' +
                ", isValid=" + isValid +
                ", sourceId=" + sourceId +
                ", sourceChannel=" + sourceChannel +
                ", sourceChangedAt=" + sourceChangedAt +
                ", isDeleted=" + isDeleted +
                ", isImport=" + isImport +
                ", method=" + method +
                ", bizId='" + bizId + '\'' +
                ", transDtoToPo='" + transDtoToPo + '\'' +
                '}';
    }

    /**
     * 将DTO 转换为PO
     * //对某个对象属性进行赋值
     * //BeanMapperUtil.populateValueByMethod(transPO,"setXxx",this.getXxx);
     *
     * @param poClass dto 需要转换的dto
     * @author guorp1
     * @since 2018/7/22 0022
     */
    @Override
    public <T extends BasePO> T transDtoToPo(Class<T> poClass) {
        return super.transDtoToPo(poClass);
    }

    /**
     * 将DTO 转换为PO
     * BeanMapperUtil.populateValueByMethod(transPO,"setXxx",this.getXxx);
     *
     * @param po 需要转换的对象
     * @author guorp1
     * @since 2018/7/22 0022
     */
    public <T extends BasePO> void transDtoToPo(T po) {
        BeanMapperUtil.copyProperties(this, po, "brandId");
    }

}
